"""
多模态-图片理解
"""

import base64
from langchain_core.messages import HumanMessage
from models import get_ali_vl_model_client

file_path = "../data/document/1.png"
with open(file_path, "rb") as image_file:
    data = base64.b64encode(image_file.read()).decode('utf-8')

message = HumanMessage(
    content=[
        {"type": "text", "text": "简单描述下这张图片的内容"},
        {
            "type": "image_url",
            "image_url": {"url": f"data:image/jpeg;base64,{data}"},
        },
    ],
)
llm = get_ali_vl_model_client()
print(llm.invoke([message]).content)
